package org.sgx.gapigui.client.ui.editableModels.books;

import org.sgx.gapi.client.apis.books.Volume;
import org.sgx.gwteditors.client.impl1.edbean.EditableBean;

import com.google.gwt.core.client.GWT;

public abstract class Book implements EditableBean {
	
	String id, title, authorName, description, language;
	
	public static Book from(Volume vol) {
		Book b = GWT.create(Book.class); 
		b.setId(vol.id()); 
		b.setTitle(vol.volumeInfo().title()); 
		b.setAuthorName(vol.volumeInfo().authors().join(", ")); 
		b.setDescription(vol.volumeInfo().description()); 
		b.setLanguage(vol.volumeInfo().language()); 
		return b;
	}
	
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getAuthorName() {
		return authorName;
	}

	public void setAuthorName(String authorName) {
		this.authorName = authorName;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}



}
